package com.upeoe.shiro.chapter5.entity;

import java.io.Serializable;

/**
 * @author ven_hxz
 * @create 2016-07-05 上午10:04
 */
public class UserRole implements Serializable {
    private Long userId;        //用户ID
    private Long roleId;        //角色ID

    public UserRole() {
    }

    public UserRole(Long userId, Long roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (roleId != null ? roleId.hashCode() : 0);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || this.getClass() != obj.getClass()) return false;

        UserRole userRole = (UserRole) obj;
        if (userId != null ? !userId.equals(userRole.roleId) :
                userRole.userId != null) return false;
        if (roleId != null ? !roleId.equals(userRole.roleId) :
                userRole.roleId != null) return false;

        return true;
    }

    @Override
    public String toString() {
        return "UserRole{" +
                "userId=" + userId +
                ", roleId=" + roleId +
                '}';
    }
}
